Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
object HTMLImageElement showing instead of [object chart image

I'm using HTML to canvas to download the HTML page with n number of charts. but the chart images are didn't displayed in my document(2016 word or lower versions).

Can anybody help me to solve this? else would suggest the new method for downloading the html with chart images in the word document.

here is my html2canvas code.

var chartCount = document.getElementById(listofCharts).children.length;
            var charts = document.getElementById(listofCharts).children;
                        
            //Navigate through each chart area.. add to canvas and add to word.
                //Get the chart Details
                 for (crt=0; crt<chartCount;crt++){
                    var chartKids = (charts[crt].children)[0].children;
                     await html2canvas(chartKids[1]).then(canvas => {  
                           var dataURL = canvas.toDataURL();
                           //chartImages[crt] = "<img src ='"+dataURL+"'>";   
                        //console.log("dataURL "+dataURL);
                        
                        var imageD1 = new Image;                        
                        var image = dataURL;

                        imageD1.src = image;                        
                        console.log(imageD1);
                        chartImages[crt] = imageD1;
                      }); 
                      
                }
                    
                //Get the table contents.
                for (i = 0; i< chartCount;i++){
                    var chartKids = (charts[i].children)[0].children;
                    tableContents[i] = chartKids[0].innerHTML       
                }       
                
        
                //Combine all the above data in a nice format to show in word. 
                for(x=0;x<tableContents.length;x++){
                    
                    wordHtml = wordHtml + tableContents[x] + breakLine;
                    wordHtml = wordHtml + chartImages[x] + breakLine;
                    
                    //Retain the H1 tag here after the chart. This is used to create page Break.
                    wordHtml = wordHtml  + "<h1> end of section   </h1>" + breakLine;
                }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda